<template>
    <div id="app">
        <router-view></router-view>
    </div>
</template>

<script>
import Cookies from 'js-cookie';
export default {
    mounted() {
        this.init();
    },
    methods: {
        init() {
            // 登录
            if(Cookies.get('token')) {
                let user = Cookies.get('user');
                try{
                    user = JSON.parse(user) || {};
                    this.$store.commit('setUser', user);
                }catch(e){
                    //TODO handle the exception
                }
            }
        }
    }
};
</script>

<style lang="less">
@import "./assets/styles/ui.less";
@import "./assets/styles/loading.less";
</style>
